const express = require("express")

// 创建服务器
const app = express()

// 引入路由
const heroRouter =  require("./route/hero")
const exsql = require("./utils/mysql")

// 跨域的问题
app.use((request,response,next)=>{
    // response.set("content-type","application/json")
    response.set('Access-Control-Allow-Origin', "*")
    next()
})
// 获取post请求
app.use(express.urlencoded())

// 同意访问接口hero
app.use("/hero",heroRouter)

// 静态托管页面
app.use(express.static("uploads/"))


// 开启监听
app.listen(4555,()=>{
    console.log("4555端口已开启,你可以访问了")
})